function switchJS(){
    // alert('这是外部引入，哈哈哈哈')
    // js switch结构
    var monthStr=prompt("请输入月份","例如:10 ")
    var month = Number.parseInt(monthStr)
    switch(month){
        case 3:
        case 4:
        case 5:
            console.log("春季");
            break;
        case 6:
        case 7:
        case 8:
            console.log("夏季");
            break;
        case 9:
        case 10:
        case 11:
            console.log("秋季");
            break;
        case 12:
        case 1:
        case 2:
            console.log("冬季");
            break;
        default:
            console.log("月份有误")
    }
}

function whileJS() {
    alert("开始执行99乘法表")
    // 打印99乘法表
    var i = 1;
    while(i<=9){
        var j = 1;
        while(j<=i){
            document.write(j+"*"+i+"="+i*j+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
            j++;
            console.log("j="+j);
        }
        document.write("<hr/>");
        i++;
        console.log("i="+i);
    }
}
// foreach中遍历的是索引
function foreachJS(){
    alert("开始执行foreach");
    var cities=["北京","上海","深圳","武汉","西安","成都"];
    document.write("<ul>");
    for(var index in cities){
        document.write("<li>"+cities[index]+"</li>");
    }
    document.write("</ul>");

}

